<?php
namespace app\site\controller;

use app\common\controller\SiteBase;
use think\facade\Session;
use think\facade\Db;

class Index extends SiteBase
{
    public function index()
    {
        // 分配菜单数据
        // $auth = new AuthRule();
        // $menu_data = $auth->getMenu();
        // foreach ($menu_data as $k => $v) {
        //     if ( $this->checkMenuAuth($v['name']) ) {
        //         foreach ($v['_data'] as $m => $n) {
        //             if( $this->checkMenuAuth($n['name'])!==true ){
        //                 unset($menu_data[$k]['_data'][$m]);
        //             }
        //         }
        //     }else{
        //         // 删除无权限的菜单
        //         unset($menu_data[$k]);
        //     }
        // }
        return view('',['web'=>$this->web]);
    }

    public function home()
    {
        $tables = Db::connect('dynamic')->getTables();
        $modules = Db::connect('dynamic')->name('destoon_module')->where('moduleid','in','23,24')->select();
        $output = http_request($this->web['url'].'/client_destoon.php?action=get_server',[
            'token:'.site_token(),
        ]);
        $server = json_decode($output, true);
        $server = $server['data'];
        return view('',['web'=>$this->web,'server'=>$server,'modules'=>$modules,'tables'=>$tables]);
    }

    public function about()
    {
        return view();
    }
}
